import {
  LocalizationContext,
  MinimalButton,
  Position,
  Tooltip,
} from "../../core";

import InfoIcon from "./InfoIcon";
import { RenderShowPropertiesProps } from "./ShowProperties";
import { FC, useContext } from "react";

const TOOLTIP_OFFSET = { left: 0, top: 8 };

const ShowPropertiesButton: FC<RenderShowPropertiesProps> = ({ onClick }) => {
  const l10n = useContext(LocalizationContext);
  const label =
    l10n && l10n.properties
      ? l10n.properties.showProperties
      : "Show properties";

  return (
    <Tooltip
      position={Position.BottomCenter}
      target={
        <MinimalButton onClick={onClick}>
          <InfoIcon />
        </MinimalButton>
      }
      content={() => label}
      offset={TOOLTIP_OFFSET}
    />
  );
};

export default ShowPropertiesButton;
